package com.r2coding.article.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.r2coding.article.entity.ArticleLabelEntity;
import com.r2coding.article.service.ArticleLabelService;
import com.r2coding.common.util.PageUtils;
import com.r2coding.common.util.Result;

/**
 * 文章标签中间表
 *
 * @author 98k灬
 * @email hk666zx@163.com
 * @date 2022-04-13 19:34:15
 */
@RestController
@RequestMapping("article/articlelabel")
public class ArticleLabelController {
    @Autowired
    private ArticleLabelService articleLabelService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public Result list(@RequestParam Map<String, Object> params){
        PageUtils page = articleLabelService.queryPage(params);

        return Result.ok();
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public Result info(@PathVariable("id") String id){
		ArticleLabelEntity articleLabel = articleLabelService.getById(id);

        return Result.ok();
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public Result save(@RequestBody ArticleLabelEntity articleLabel){
		articleLabelService.save(articleLabel);

        return Result.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public Result update(@RequestBody ArticleLabelEntity articleLabel){
		articleLabelService.updateById(articleLabel);

        return Result.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public Result delete(@RequestBody String[] ids){
		articleLabelService.removeByIds(Arrays.asList(ids));

        return Result.ok();
    }

}
